/**
 *                            License
 * THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS  
 * CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). 
 * THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW.  
 * ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR  
 * COPYRIGHT LAW IS PROHIBITED.
 * 
 * BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND  
 * AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE  
 * MAY BE CONSIDERED TO BE A CONTRACT,
 * THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED 
 * HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS.
 * 
 */
package lineage.controller.pc;

import lineage.model.instance.L1PcInstance;

/**
 * 计算角色的状态.
 * 
 * @version 2014年3月21日下午8:31:39
 * @author jrwz
 */
public final class CalcStat {
    private CalcStat() {
    }

    /**
     * 计算物理防御(敏捷加成).
     * 
     * @param pc
     *            - 角色
     */
    protected static int calcAc(final L1PcInstance pc) {
        int acBonus = 10;
        final int level = pc.getLevel();
        switch (pc.getDex()) {
        case 0:
        case 1:
        case 2:
        case 3:
        case 4:
        case 5:
        case 6:
        case 7:
        case 8:
        case 9:
            acBonus -= level >> 3; // (/8)
            break;
        case 10:
        case 11:
        case 12:
            acBonus -= level / 7;
            break;
        case 13:
        case 14:
        case 15:
            acBonus -= level / 6;
            break;
        case 16:
        case 17:
            acBonus -= level / 5;
            break;
        default:
            acBonus -= level >> 2; // (/4)
            break;
        }
        return acBonus;
    }
}
